<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data() {
    return {
      dataFormConfig: {
        id: {
          hidden: true
        },
        paramKey: {
          label: '参数名',
          placeholder: '请输入参数名'
        },
        paramValue: {
          label: '参数值',
          placeholder: '请输入参数值'
        },
        remark: {
          inputType: 'textarea',
          label: '备注',
          placeholder: '请输入备注'
        }
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0

      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule('paramKey', 'paramValue'),
        initApi: 'systemApi/configInfo',
        saveApi: 'systemApi/saveConfig',
        updateApi: 'systemApi/updateConfig',
        objectName: 'config'
      })
    }
  }
}
</script>
